/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lexico;

/**
 *
 * @author Pedrom
 */
public class FsmOperator {

    private String first, second;

    public FsmOperator(String first) {
        this.first = first;
        this.second = "";
    }

    public FsmOperator(String first, String second) {
        this.first = first;
        this.second = second;
    }

    public boolean isOperator() {
        StringBuilder str = new StringBuilder();
        str.append(first);
        str.append(second);

        Operators op = new Operators();

        if (first.equals("+") && (second.equals("") || second.equals("+"))) {
            return true; //Operador + ou  ++.
        }
        if (first.equals("-") && (second.equals("") || second.equals("-"))) {
            return true; // Operador - ou --.
        }
        if (first.equals("=") && (second.equals("") || second.equals("="))) {
            return true;
        }
        if ((first.equals(">") || first.equals("<")) && (second.equals("") || second.equals("="))) {
            return true; //Operadores > < >= <=
        }
        if (first.equals("!") && second.equals("=")) {
            return true; // Operador !=
        }
        if (first.equals("&") && second.equals("&")) {
            return true; // Operador &&
        }
        if (first.equals("|") && second.equals("|")) {
            return true; // Operador ||
        }
        if (op.isSingle(str.toString())) {
            return true; //Operadores sigle, * / .
        } else {
            return false;
        }
    }
}
